package com.symaster.common.geom.canvas.repeater;

import java.awt.*;
import java.awt.event.MouseEvent;

/**
 * @author yinmiao
 * @version 2022-07-14 15:30
 */
public class BaseRepeater {
    private final Component component;

    public BaseRepeater(Component component) {
        this.component = component;
    }

    public MouseEvent generateRepeaterMouseEvent(MouseEvent e) {
        Point location = component.getLocation();
        return new MouseEvent(
                component,
                e.getID(),
                e.getWhen(),
                e.getModifiers(),
                e.getX() + location.x,
                e.getY() + location.y,
                e.getClickCount(), false);
    }
}
